<script language=Javascript><!--
function setVenue (value) {
	var f= document.forms[0];
	if (typeof(value) != 'undefined') {  //set value if given one
		f.MATCH_VENUE.value= value;
	} else {                             //otherwise find the matching value
		value= f.MATCH_VENUE.value;
		for (var i= 0; i<f.MATCH_VENUE_SELECT.options.length; i++) {
			if (f.MATCH_VENUE_SELECT.options[i].value == value) {
				f.MATCH_VENUE_SELECT.selectedIndex= i;
				break;
			}
		}
	}
	
}

<TMPL_VAR NAME=MATCHSTATS_HOMETEAM_TEAM_SUBS ESCAPE=JS>
<TMPL_VAR NAME=MATCHSTATS_AWAYTEAM_TEAM_SUBS ESCAPE=JS>

function setSubs () {
	var f= document.forms[0];
	for (var i= 0; i<f.elements.length; i++) {
		if (f.elements[i].type == 'checkbox') {
			if (eval("typeof("+f.elements[i].name+") != 'undefined'")) {
				f.elements[i].checked= 1;
			}
		}
	}
}

//-->
</script>

<h2 class="contentTitle">Edit Match Details</h2>

<fieldset>
<table class="contentTable">
<tr>
<td class="label">Season:</td>
<td colspan=2><select name="FK_SEASON_ID"><TMPL_VAR NAME=SEASON_SEASON_OPTIONS></select><br/>
<small><a href="javascript:editObject('<TMPL_VAR NAME=SEASON_PK_OBJECT_ID>','SEASON')">Edit</a></small></td>
</tr>
<tr>
<td class="label">Competition:</td>
<td colspan=2><select name="FK_COMPETITION_ID"><TMPL_VAR NAME=COMPETITION_COMPETITION_OPTIONS></select><br/>
<small><a href="javascript:editObject('<TMPL_VAR NAME=COMPETITION_PK_OBJECT_ID>','COMPETITION')">Edit</a></small></td>
</tr>
<tr>
<td class="label">Match Name:</td>
<td colspan=2><input type=text name=MATCH_NAME value="<TMPL_VAR NAME=MATCH_NAME>" size=80><br/>
<small><a href="<TMPL_VAR NAME=CGI_BASE_URL>s=MATCHSTATS&o=<TMPL_VAR NAME=PK_OBJECT_ID>">View</a></small></td>
</tr>
<tr>
<td class="label">KO:</td>
<td colspan=2><input type=text name=MATCH_KOTIME_DATE value="<TMPL_VAR NAME=MATCH_KOTIME_EDATE>" size=10>
<input type=text name=MATCH_KOTIME_TIME value="<TMPL_VAR NAME=MATCH_KOTIME_TIME>" size=6><br>
<span class=instructions>yyyy-mm-dd hh:mm</small>
</td>
</tr>
<tr>
<td class="label">Match Status:</td>
<td colspan=2><select name="MATCHSTATS_STATUS"><TMPL_VAR NAME=MATCHSTATS_STATUS_OPTIONS></select><br/>
<small></small></td>
</tr>
<tr>
<td class="label">Venue:</td>
<td colspan=2><select name="MATCH_VENUE_SELECT" onchange="setVenue(this.options[this.selectedIndex].value);">
	<option value="__DEFAULT__">Home Squad Stadium</option>
	<!-- option value="Away">Away</option -->
	<option value="__OTHER__" selected>Other ...</option>
	</select>
	<select name="FK_STADIUM_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=STADIUM_STADIUM_OPTIONS>
	</select>
	<TMPL_VAR NAME=MATCH_VENUE><br>
	 <input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_STADIUM_ID>','STADIUM');" value="Edit">
	<input type=button class="button" onClick="addObject('STADIUM','')"; value="Add Stadium">

	<input type=hidden name=MATCH_VENUE value="<TMPL_VAR NAME=MATCH_VENUE>" size=66></td>
</tr>
<tr>
<td class="label">Referee:</td>
<td  colspan=2>
	<select name="FK_REFEREE_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=REFEREE_REFEREE_OPTIONS>
	</select> <TMPL_VAR NAME=MATCH_REFEREE><br>
	 <input type=button onClick="editObject('<TMPL_VAR NAME=FK_REFEREE_ID>','REFEREE');" value="Edit" class="button">
	<input type=button onClick="addObject('REFEREE','');" value="Add Referee" class="button">

<input type=hidden name=MATCH_REFEREE value="<TMPL_VAR NAME=MATCH_REFEREE>" size=80></td>
</tr>
<tr>
<td class="label">Attendance:</td>
<td  colspan=2><input type=text name=MATCH_ATTENDANCE value="<TMPL_VAR NAME=MATCH_ATTENDANCE>" size=20></td>
</tr>
<tr>
<td class="label">Notes:</td>
<td colspan=2><textarea name=MATCH_NOTES rows=5 cols=55><TMPL_VAR NAME=MATCH_NOTES></textarea></td>
</tr>
<tr>
<td class="label">Weather:</td>
<td colspan=2><textarea name=MATCH_WEATHER rows=2 cols=55><TMPL_VAR NAME=MATCH_WEATHER></textarea><br>
<a href="http://uk.weather.com/weather/detail/<TMPL_VAR NAME=STADIUM_STADIUM_POSTCODE_AREA>?dayNum=<TMPL_VAR NAME=MATCHSTATS_WEATHER_DAYNO>" target="_blank">View forecast</a></td>
</tr>
<tr>
<td class="label">TV:</td>
<td colspan="2"><select name="FK_TVCHANNEL_ID"><option value=""> --- None ---</option>
<TMPL_VAR NAME=TVCHANNEL_TVCHANNEL_OPTIONS></select> <TMPL_VAR NAME=TVCHANNEL_TVCHANNEL_ICONIMAGE><br>
	 <input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_TVCHANNEL_ID>','TVCHANNEL');" value="Edit">
	<input type=button class="button" onClick="addObject('TVCHANNEL','');" value="Add Channel">
</td>
</tr>
<tr>
<td colspan=2>
<div class="submit">
<input type=button class="button" onClick="updateObject('MATCHSTATS','<TMPL_VAR NAME=o>','<TMPL_VAR NAME=p>','Matchstats.Edit');" value="Update &raquo;">
</div>
</td>
<tr>
<td class="label">Home Team:</td>
<td colspan=2>

	<table>
	<tr>
	<td><small>Club</small></td>
	<td><small>Squad</small></td>
	</tr>
	<tr>
	<td valign=top>
	<select name="FK_HOME_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=MATCHSTATS_HOMECLUB_CLUB_OPTIONS>
	</select><br>
	<input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_HOME_ID>','CLUB');" value="Edit">
	<input type=button class="button" onClick="addObject('CLUB');" value="Add Club">

	<td valign=top>
	<select name="FK_HOMESQUAD_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=MATCHSTATS_SQUAD_OPTIONS_FK_HOMESQUAD_ID>
	</select><br>
	<input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_HOMESQUAD_ID>','SQUAD');" value="Edit">
	<input type=button class="button" onClick="addObject('SQUAD','<TMPL_VAR NAME=MATCHSTATS_HOMETEAM_CLUB_PK_OBJECT_ID>');" value="Add Squad">

	</td>
	</tr>
	</table>
</td>
</tr>
<tr>
<td class="label">FT Score:</td>
<td colspan=2><input type=text name="MATCH_HOMESCORE" value="<TMPL_VAR NAME=MATCH_HOMESCORE>" size=5></td>
</tr>
<tr>
<td class="label">HT Score:</td>
<td colspan=2><input type=text name="MATCH_HOMEHTSCORE" value="<TMPL_VAR NAME=MATCH_HOMEHTSCORE>" size=5></td>
</tr>
<tr>
<td class="label">Away Team:</td>
<td colspan=2>
	<table>
	<tr>
	<td><small>Club</small></td>
	<td><small>Squad</small></td>
	</tr>
	<tr>
	<td valign=top>
	<select name="FK_AWAY_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=MATCHSTATS_AWAYCLUB_CLUB_OPTIONS>
	</select><br>
	<input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_AWAY_ID>','CLUB');" value="Edit">
	<input type=button class="button" onClick="addObject('CLUB');" value="Add Club">
	</td>
	<td valign=top>
	<input type="hidden" name="SQUAD_OPTIONS_FK_CLUB_ID_<TMPL_VAR NAME=FK_AWAY_ID>" value="">
	<select name="FK_AWAYSQUAD_ID">
		<option value="">Please select ...</option>
		<TMPL_VAR NAME=MATCHSTATS_SQUAD_OPTIONS_FK_AWAYSQUAD_ID>
	</select><br>
	<input type=button class="button" onClick="editObject('<TMPL_VAR NAME=FK_AWAYSQUAD_ID>','SQUAD');" value="Edit">
	<input type=button class="button" onClick="addObject('SQUAD','<TMPL_VAR NAME=MATCHSTATS_AWAYTEAM_CLUB_PK_OBJECT_ID>');" value="Add Squad">

	</td>
	</tr>
	</table>
	
</td>
</tr>
<tr>
<td class="label">FT Score:</td>
<td colspan=2><input type=text name="MATCH_AWAYSCORE" value="<TMPL_VAR NAME=MATCH_AWAYSCORE>" size=5></td>
</tr>
<tr>
<td class="label">HT Score:</td>
<td colspan=2><input type=text name="MATCH_AWAYHTSCORE" value="<TMPL_VAR NAME=MATCH_AWAYHTSCORE>" size=5></td>
</tr>
<tr>
<td class="label">Summary Active:</td>
<td colspan=2><select name="MATCHSTATS_STATSACTIVE">
<TMPL_VAR NAME=MATCHSTATS_STATSACTIVE_OPTIONS>
</select><br>
<small>Set to True when at least result has been entered.</small>
</td>
</tr>
<tr>
<td colspan=3>
<div class="submit">
<input type=button class="button" onClick="updateObject('MATCHSTATS','<TMPL_VAR NAME=o>','<TMPL_VAR NAME=p>','Matchstats.Edit');" value="Update &raquo;">
</div>
</td>
</tr>
<tr>
<th colspan=3>
	<TMPL_VAR NAME=MATCHSTATS_HOMETEAM_CLUB_CLUB_NAME> Team
</th>
</tr>
<tr>
<td colspan=2>Player:</td>
<td>Sub:</td>
</tr>

	<TMPL_VAR NAME=MATCHSTATS_HOMETEAM_TEAM_LIST>
<tr>
<td colspan=3>
Team Details:
<textarea name="TEAM_STRING_HOME" rows=3 cols=80></textarea>
</td>
</tr>
<tr>
<td colspan=3>
<div class="submit">
<input type=button class="button" onClick="addObject('PLAYER')" value="Add Player">
<input type=button class="button" onClick="updateObject('MATCHSTATS','<TMPL_VAR NAME=o>','<TMPL_VAR NAME=p>','Matchstats.Edit');" value="Update &raquo;">
</div>
</td>
</tr>
<tr>
<th colspan=3>
	<TMPL_VAR NAME=MATCHSTATS_AWAYTEAM_CLUB_CLUB_NAME> Team
</th>
</tr>
<tr>
<td colspan=2>Player:</td>
<td>Sub:</td>
</tr>

	<TMPL_VAR NAME=MATCHSTATS_AWAYTEAM_TEAM_LIST>
<tr>
<td colspan=3>
Team Details:
<textarea name="TEAM_STRING_AWAY" rows=3 cols=80></textarea>
</td>
</tr>
<tr>
<td colspan=3>
<div class="submit">
<input type=button class="button" onClick="addObject('PLAYER')"; value="Add Player">
<input type=button class="button" onClick="updateObject('MATCHSTATS','<TMPL_VAR NAME=o>','<TMPL_VAR NAME=p>','Matchstats.Edit');" value="Update &raquo;">
</div>
</td>
</tr>
<tr>
<td class="label">No. Positions:</td>
<td colspan="2">
<input type="text" name="MATCHSTATS_NPOSITIONS" value="<TMPL_VAR NAME=MATCHSTATS_NPOSITIONS>" size="5">
</td>
</tr>
<tr>
<td class="label">Active MOTM Voting:</td>
<td colspan="2"><select name="MATCHSTATS_MOTMACTIVE">
<TMPL_VAR NAME=MATCHSTATS_MOTMACTIVE_OPTIONS>
</select>
</td>
</tr>
<tr>
<td class="label">Related News:</td>
<td><select name="RELATED_NEWS" multiple size=7>
<TMPL_VAR NAME=RELATED_OPTIONS_NEWS>
</select>
<TMPL_VAR NAME=_OBJECT_UPDATE_ERROR_RELATED_NEWS_></td>
</tr>
<tr>
<td class="label">Related Content IDs:</td>
<td><input type="text" name="RELATEDOLD_IDS" size=80 value=""><br>
<small>Comma seperated list of os to related to this </small></td>
</tr>
<tr>
<td colspan=3>
<div class="submit">
<input type=button class="button" onClick="updateObject('MATCHSTATS','<TMPL_VAR NAME=o>','<TMPL_VAR NAME=p>','Matchstats.Edit');" value="Update &raquo;">
</div>
</td>
</tr>
</table>
</fieldset>

<TMPL_VAR NAME=OBJECTS> 

<script language=javascript><!--
	setVenue();
	setSubs();
//-->
</script> 